import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'index',
    component: () => import('../views/index.vue'),
    redirect:"/recommend",
    children:[
      {
    path: 'recommend',
    name: 'recommend',
    component: () => import('../views/index/recommend.vue'),  
    meta:{
      title:"今日歌曲推荐"
    }
    },  {
    path: 'hot',
    name: 'hot',
    component: () => import('../views/index/hot.vue'),  
    meta:{
      title:"Hot热歌榜"
    }
    },  {
    path: 'search',
    name: 'search',
    component: () => import('../views/index/search.vue'),  
    meta:{
      title:"搜你心中所属"
    }
    },
  ]
  },
  {
    path: '/personal',
    name: '/Personal',
    component: () => import("../views/Personal.vue"),
    },
    {
      path: '/album',
      name: '/album',
      component: () => import("../views/album.vue"),
      },
]

const router = new VueRouter({
  "linkActiveClass":"active",
  routes

})

router.beforeEach((to,from,next) =>{
  document.title = to.meta.title;
  next();
})

export default router
